/-boot
/-docs
/-editor
/-files
/-files-old
/-imports
/-layout
/-shell
/-storage
/-tests
/-typings
Dom.ts
TypeScriptService.ts
functions.ts
ko.ts
nteapo.html
persistence.api.ts
persistence.ts
shell.ts
teapo.html
teapo.ts
try.html
try.js
​x
      error: true,
 
26
    /** Main public API of TypeScript compiler/parser engine. */
27
    service: TypeScript.Services.ILanguageService;
28
​
29
    /** Files added to the compiler/parser scope, by full path. */
30
    scripts: { [fullPath: string]: TypeScriptService.Script; } = {};
31
​
32
    log: { logLevel: string; text: string; }[] = null;
33
  
34
    private _logLevel: string = null;
35
​
36
​
37
    constructor() {
38
​
39
      var factory = new TypeScript.Services.TypeScriptServicesFactory();
40
      this.service = factory.createPullLanguageService(this._createLanguageServiceHost());
41
    }
42
​
43
    /**
44
     * The main API required by TypeScript for talking to the host environment. */
45
    private _createLanguageServiceHost() {
46
      return {
47
        getCompilationSettings: () => this.compilationSettings,
48
        getScriptFileNames: () => {
49
          var result = Object.keys(this.scripts).filter(k => this.scripts.hasOwnProperty(k)).sort();
50
          //console.log('...getScriptFileNames():',result);
51
          return result;
52
        },
53
        getScriptVersion: (fileName: string) => {
54
          var script = this.scripts[fileName];
55
          if (script.changes)
56
            return script.changes().length;
57
          return 0;
58
        },
59
        getScriptIsOpen: (fileName: string) => {
60
          return true;
61
        },
62
        getScriptByteOrderMark: (fileName: string) => TypeScript.ByteOrderMark.None,
63
        getScriptSnapshot: (fileName: string) => {
64
          var script = this.scripts[fileName];
65
          var snapshot = <TypeScriptDocumentSnapshot>script._cachedSnapshot;
66
​
67
          // checking if snapshot is out of date
68
          if (!snapshot || (script.changes && snapshot.version < script.changes().length)) {
69
            script._cachedSnapshot =
70
            snapshot = new TypeScriptDocumentSnapshot(script);
71
          }
72
​
73
          return snapshot;
74
        },
75
        getDiagnosticsObject: () => {
76
          return { log: (text: string) => this._log(text) };
77
        },
78
        getLocalizedDiagnosticMessages: () => null,
79
        information: () => {
80
          this._logLevel = 'information';
81
          return this.logLevels.information;
82
        },
83
        debug: () => {
84
          this._logLevel = 'debug';
85
          return this.logLevels.debug;
86
        },
87
        warning: () => {
88
          this._logLevel = 'warning';
89
          return this.logLevels.warning;
90
        },
91
        error: () => {
92
          this._logLevel = 'error';
93
          return this.logLevels.error;
94
        },
95
        fatal: () => {
96
          this._logLevel = 'fatal';
97
          return this.logLevels.fatal;
98
        },
99
        log: (text: string) => this._log(text),
100
        resolveRelativePath: (path: string) => {
101
          var result = path;
102
          //console.log('...resolveRelativePath('+path+'):', result);
103
          return result;
104
        },
105
        fileExists: (path: string) => {
106
          // don't issue a full resolve,
107
          // this might be a mere probe for a file
108
          return this.scripts[path] ? true : false;
109
        },
110
        directoryExists: (path: string) => true,
111
        getParentDirectory: (path: string) => {
18:18